using System;
using System.Collections.Generic;
using System.Text;
using MyPhotoIndex.Interfaces;
using MyPhotoIndex.Interfaces.Imaging;
using System.IO;

namespace MyPhotoIndex
{
    class DateTakenImageListSorter : IImageSortComparer
    {
        public override String ToString()
        {
            return Resources.Resources.DateTakenFilterString;
        }

        public int Compare(IImageData x, IImageData y)
        {
            return (y.DateTaken.CompareTo(x.DateTaken));
        }
    }

    class DateImportedImageListSorter : IImageSortComparer
    {
        public override String ToString()
        {
            return Resources.Resources.ImportOrderFilterString;
        }

        public int Compare(IImageData x, IImageData y)
        {
            return (y.Id - x.Id);
        }
    }

    class RatingImageListSorter : IImageSortComparer
    {
        public override String ToString()
        {
            return Resources.Resources.RatingFilterString;
        }

        public int Compare(IImageData x, IImageData y)
        {
            return (y.Rating - x.Rating);
        }
    }

    class CategoryImageListSorter : IImageSortComparer
    {
        public override String ToString()
        {
            return Resources.Resources.CategorySortString;
        }

        public int Compare(IImageData x, IImageData y)
        {
            return y.Categories.Length - x.Categories.Length;
        }
    }

    class FileNameImageListSorter : IImageSortComparer
    {
        public override String ToString()
        {
            return Resources.Resources.FileNameSortString;
        }

        public int Compare(IImageData x, IImageData y)
        {
            return string.Compare(Path.GetFileNameWithoutExtension(y.FileName), Path.GetFileNameWithoutExtension(x.FileName), true);
        }
    }
}
